Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add tests for PATCH /requests/:id API for onboarding extension requests #2335

Merged

Conversation

pankajjs
Copy link
Member

@pankajjs pankajjs commented Jan 3, 2025

Date: 3 Dec, 2025

Developer Name: @pankajjs


Issue Ticket Number

Description

This PR adds test cases for the PATCH /requests/:id API for onboarding extension requests to ensure its correctness and reliability. The tests cover the following scenarios:

  • Valid input for updating extension details.
  • Invalid input handling (e.g., missing or incorrect fields).
  • Authentication and authorization checks.
  • Error handling for edge cases and unexpected failures.

These tests aim to improve the overall robustness and maintainability of the API.

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Test Coverage

Screenshots Screenshot 2025-01-15 at 5 08 23 PM Screenshot 2025-01-15 at 5 10 12 PM Screenshot 2025-01-15 at 5 12 21 PM Screenshot 2025-01-17 at 4 12 49 PM

Additional Notes

Feature PR #2334

@pankajjs pankajjs force-pushed the feat/add-test-for-edit-api branch from 9cf0edd to 5f7436c Compare January 7, 2025 13:55
@pankajjs pankajjs marked this pull request as ready for review January 7, 2025 14:19
@pankajjs pankajjs force-pushed the feat/add-test-for-edit-api branch 3 times, most recently from 024dc63 to 906318e Compare January 12, 2025 13:46
@pankajjs pankajjs force-pushed the feat/add-test-for-edit-api branch 5 times, most recently from 0abdafd to fde07e1 Compare January 16, 2025 19:35
@pankajjs pankajjs force-pushed the feat/add-test-for-edit-api branch from b9ad3b4 to 2561da7 Compare January 18, 2025 20:08
- Remove failing tests and fix existing tests

- Add tests to check success and unexpected behaviour and fix existing tests

- Replace actual messages with constants for easily maintenance

- Add test for super user and request owner authorization check and fix existing failing tests

- Remove un-necessary changes

- Remove separate file for validator tests
@pankajjs pankajjs force-pushed the feat/add-test-for-edit-api branch from 2561da7 to c1294d2 Compare January 23, 2025 06:06
@pankajjs pankajjs changed the title feat: Add tests for edit extension details api feat: Add tests for PATCH /requests/:id API for onboarding extension requests Jan 23, 2025
@iamitprakash iamitprakash merged commit f4e99fb into Real-Dev-Squad:develop Jan 25, 2025
3 checks passed
iamitprakash added a commit that referenced this pull request Jan 26, 2025
* chore: remove duplicate function call for onboarding extension request (#2361)

* feat: Implement Pagination for GET /progreses API (#2325)

* feat: add pagination to GET /progreses API

* fix returning 404 on a page with no data

* fix joi validator logic

* refactor getting totalcount logic

* fix dev true

* fix merge conflicts

* using constant

* maked the JsDoc more concise

---------

Co-authored-by: Vinit khandal <[email protected]>

* test : add tests for pagination of progresses api (#2328)

* added test for the get progresses pagination

* added test for dev=false

* minor fix

* added unit test for utils/progresses functions

* added progressed model unit tests

* added test for 500

* added 500 message from constant

* fix test naming

* feat: Add an API to edit onboarding extension request details before approval or rejection (#2334)

* feat: Add feature to update request before approval or rejection
- Add common validator to redirect request based on type of extension
- Add type field in onboarding extension validator
- Import addLog from services to make it available for stubbing while testing
- Moved response messages to constants file
- Reuse single instance of current date in request and log model for consistent data

- Change controller name

- Remove unused variables

- Add authorization check for superuser or request ownership

- Change authorization condition

- Remove unnecessary changes

* fix: add logs for failure cases and fix check for same old and new deadline

* refactor: separate validation and update logic in service file

* chore: fix jsDoc

* fix: send id instead of while request doc while updating it

* chore: fix lint issue

* fix: change validation response condition and fix jsDoc

* fix: add strict checking

* fix: change constant message

* feat: Add tests for PATCH /requests/:id API for onboarding extension requests (#2335)

* feat: Add test cases for controller and validator

- Remove failing tests and fix existing tests

- Add tests to check success and unexpected behaviour and fix existing tests

- Replace actual messages with constants for easily maintenance

- Add test for super user and request owner authorization check and fix existing failing tests

- Remove un-necessary changes

- Remove separate file for validator tests

* feat: add tests for onboarding update and validate service

* Merge pull request #2369 from pankajjs/fix/flaky-test

Fix flaky test present in PR[2335]

* fix: handle id query parameter in Get Requests API (#2367)

Co-authored-by: Vikas Singh <[email protected]>
Co-authored-by: Achintya Chatterjee <[email protected]>

---------

Co-authored-by: Yash Raj <[email protected]>
Co-authored-by: Pankaj <[email protected]>
Co-authored-by: Anuj Chhikara <[email protected]>
Co-authored-by: Vinit khandal <[email protected]>
Co-authored-by: Vikas Singh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature : Extend Onboarding Override for Discord Server
3 participants